* Generates RER from PWT 
use "PWT/input/pwt91.dta", clear
keep countrycode country currency_unit year pl_gdpo
ren pl_gdpo rer // RER is based on pl_gdpo
gen PPPdum = 0 // compute ratio to US
replace PPPdum = 1 if countrycode=="USA"
gen PPPconstruct = rer*PPPdum
bys year: egen rerUS = total(PPPconstruct)
replace rer = rer/rerUS
gen dum = 0 // index to 2011
replace dum = 1 if year==2011
gen rerbis = rer*dum
bys countrycode: egen rer2011 = total(rerbis)
replace rer = rer / rer2011*100
sort countrycode year
drop dum rerbis rer2011 PPPdum PPPconstruct rerUS country
ren rer rerPWT
ren countrycode ccode 
replace ccode="ROM" if ccode=="ROU"
save "PWT/output/PWT_prep.dta", replace

